/**
 * Instances of this class represent sets of elements. In combinatorial testing, a Set correspond to a parameter.
 * Each parameter has test values, which correspond to the elements in the Set.
 * @see Element
 * @author Macario Polo Usaola
 */

package edu.uclm.combTest.core;


public class Set {
	protected /*@ spec_public @*/ Vector  elements;

	/**
	 * Builds an empty set
	 */
	
	//@ensures elements.size()==0;
	public Set() {
		super();
		this.elements=new Vector();
	}

	/**
	 *
	 * @return The size of the set
	 */
	//@ensures \result == elements.size();
	public/*@ pure @*/ int size() {
		return this.elements.size();
	}

	//@requires element != null;
	//@ensures elements.size() == \old(elements.size()+1);
	//@ensures elements.contains(new Element(element));
	//contient tous les anciens éléments.
	//@ensures(\forall int i ; i>=0 && i < \old(elements.size()) ; (
	//@	elements.contains((Element)\old(elements.get(i)))));
	public void add(String element) {
		this.elements.add(new Element(element));
	}

	/**
	 *
	 * @param position The position of the element
	 * @return The element placed at the position
	 */
	//@requires position >= 0 && position < elements.size();
	//@ensures \result == elements.get(position);
	public /*@ pure @*/ Element getElementAt(int position) {
		return (Element) this.elements.get(position);
	}

}
